/* 全局样式重置和基础设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
}

/* 响应式容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background-color: #333;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
}

header h1 {
    margin-bottom: 0.5rem;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* 移动设备上允许换行 */
}

nav ul li {
    margin: 0 10px;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background-color 0.3s;
}

nav ul li a:hover {
    background-color: #555;
}

/* 主内容区域 */
main {
    padding: 2rem 0;
}

section {
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

section h2 {
    margin-bottom: 1rem;
    color: #333;
}

section img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 8px;
}

/* 日记条目样式 */
article {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-left: 4px solid #007bff;
    background-color: #f9f9f9;
}

article h3 {
    color: #007bff;
}

/* 联系表单样式 */
form {
    display: flex;
    flex-direction: column;
}

form label {
    margin-top: 0.5rem;
    font-weight: bold;
}

form input, form textarea {
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

form button {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

form button:hover {
    background-color: #0056b3;
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 1rem 0;
    background-color: #333;
    color: #fff;
    margin-top: 2rem;
}

/* 响应式设计：移动设备适配 */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column; /* 小屏幕上垂直排列导航 */
        align-items: center;
    }

    nav ul li {
        margin: 5px 0;
    }

    section {
        padding: 1rem;
    }

    form input, form textarea {
        font-size: 16px; /* 改善移动设备输入 */
    }
}